package com.ssy.lingxi.purchase.api.enums.tender;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 投标内部状态枚举类型
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/29
 */
public enum SubmitTenderInStatusEnum {
    Not_Submitted_Invite_Tender_Register(1, "待招标报名"),
    Submitted_Invite_Tender_Register(2, "已提交招标报名"),
    Not_Submitted_Qualifications_Check(3, "待提交资格预审"),
    Submitted_Qualifications_Check(4, "已提交资格预审"),
    Not_Save_Submit_Tender(5, "待新增投标"),
    Not_Submitted_Check_Submit_Tender(6, "待提交审核投标"),
    Submitted_Check_Submit_Tender(7, "待审核投标(一级)"),
    Check_Submit_Tender_Not_Pass(8, "投标审核不通过(一级)"),
    Submitted_Check_Submit_Tender_2(9, "待审核投标(二级)"),
    Check_Submit_Tender_Not_Pass_2(10, "投标审核不通过(二级)"),
    Not_Submitted_Submit_Tender(11, "待提交投标"),
    Submitted_Submit_Tender(12, "已提交投标");

    private Integer code;
    private String message;

    SubmitTenderInStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code){
        SubmitTenderInStatusEnum statusEnum = Arrays.stream(SubmitTenderInStatusEnum.values()).filter(v -> v.getCode().equals(code)).findAny().orElse(null);
        return null == statusEnum ? "" : LanguageHolder.getName(SubmitTenderInStatusEnum.class, statusEnum.getCode());
    }
}
